﻿app.service('GlobalService', ['$http', function ($http) {
    
    this.GetCountry = function () {
        return $http.get("../../Settings/UserSettings/GetCountry");
    };

    this.GetSettings = function () {
        return $http.get("../../Settings/UserSettings/GetUserSettings");
    };

    this.GetStates = function (CountryId) {
        if (typeof CountryId !== "undefined") {
            return $http.get("../../Settings/UserSettings/GetStates/", { params: { CountryId: CountryId } });
        }
    };

    this.GetChurchMemberbyChurchId = function () {
        return $http.get("GetAllChurchMembersByChurch");
    };

    this.GetLanguages = function () {
        return $http.get("../../Settings/UserSettings/GetLanguages");
    };

    this.GetDateformat = function () {
        return $http.get("../UserSettings/GetDateformat");
    };

    this.GetRelationship = function () {
        return $http.get("/CommonDataService/DataService/GetRelationship");
    };

    this.GetRelationshipByStatus = function (IsMarried) {
        return $http.get("/CommonDataService/DataService/GetRelationshipByStatus?IsMarried=" + IsMarried);
    };

    this.GetGender = function () {
        var Gender = [{ Gender: "1", GenderName: "Male" }, { Gender: "2", GenderName: "FeMale" }, { Gender: "3", GenderName: "Others" }]
        return Gender;
    };

    this.GetMinitrialType = function () {
        return $http.get("/CommonDataService/DataService/GetMinitrialType");
    }

    this.GetChurchDesignation = function (id) {
        if (typeof id !== "undefined") {
            return $http.get("/CommonDataService/DataService/GetDesignations", { params: { OrganizationId: id } });
        }
    }

    this.GetNotification = function () {
        return $http.get("/CommonDataService/DataService/GetNotification");
    }

    this.GetChurchZones = function (zoneId) {
        if (typeof zoneId !== "undefined") {
            return $http.get("/CommonDataService/DataService/GetChurchZones", { params: { OrganizationId: zoneId } });
        }
    }

    this.GetGrade = function () {
        return $http.get("/CommonDataService/DataService/GetGrade");
    }

    this.GetMembers = function () {
        return $http.get("/Church/Baptism/GetMembers");
    }

    this.GetMembersSearch = function (SearchKey) {
        return $http.get("/Church/Baptism/GetSearchMembers?SearchKey=" + SearchKey);
    }

    this.GetMembersDetails = function (memberid) {
        return $http.get("/Church/Baptism/GetMembersDetails", { params: { MemberId: memberid } });
    }

    this.GetGenders = function (memberid) {
        return [{ Gender: 1, GenderName: "Male" }, { Gender: 2, GenderName: "FeMale" }];
    }

    this.GetStatus = function () {
        return [{ StatusId: 1, StatusName: "Pending" }, { StatusId: 2, StatusName: "Rejected" }, { StatusId: 3, StatusName: "Approved" }];
    }

    this.GetChurchWorkerDesignation = function () {
        return $http.get("/Admin/ChurchWorkerMaster/GetAllChurchWorkerDesignation");
    }

    this.GetNameTitle = function () {
        return $http.get("/Admin/ChurchWorkerMaster/GetAllNameTitle");
    }


    this.GetJobtitleByMiniterialType = function (MiniterialTypeId) {
        return $http.get("/Admin/OrganizationJobtitle/GetJobTitles/?dataId=" + MiniterialTypeId);
    }

    this.GetZoneByMiniterialType = function (MiniterialTypeId) {
        return $http.get("/Admin/OrganizationJobtitle/GetJobTitles/?dataId=" + MiniterialTypeId);
    }

    this.GetChurchesByZone = function (MiniterialTypeId) {
        return $http.get("/Admin/OrganizationJobtitle/GetChurchesByZone/?dataId=" + MiniterialTypeId);
    }

    this.GetChurchWorkerStatus = function () {
        return $http.get("/Admin/OrganizationJobtitle/GetChurchWorkerStatus");
    }

    this.GetChurchWorkers = function () {
        return $http.get("/Admin/OrganizationJobtitle/GetChurchWorkerAll");
    }

    this.GetAllChurch = function () {
        return $http.get("/Admin/Church/GetChurches");
    }
    
    this.GetAllPages = function () {
        return $http.get("/Administration/ApplicationPages/GetPagesAll");
    }

    this.GetAllPageSections = function () {
        return $http.get("/Administration/ApplicationPages/GetPageSectionPkAll");
    }
    
}]);

